home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
cl_7_bug.zip
/
BUG_4.ERR
< prev
next >
Wrap
Text File
|
1992-10-10
|
10KB
|
341 lines
; Static Name Aliases
;
TITLE bug_4.c
.8087
INCLUDELIB LLIBCE
INCLUDELIB OLDNAMES.LIB
BUG_4_TEXT SEGMENT WORD PUBLIC 'CODE'
BUG_4_TEXT ENDS
_DATA SEGMENT WORD PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT WORD PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT WORD PUBLIC 'BSS'
_BSS ENDS
DGROUP GROUP CONST, _BSS, _DATA
ASSUME DS: DGROUP, SS: DGROUP
EXTRN __acrtused:ABS
EXTRN _printf:FAR
EXTRN _puts:FAR
_DATA SEGMENT
$SG269 DB '!!!!!!!!!!!!!!!!WORKS!', 00H
$SG270 DB 'What a suprise, the function worked', 00H
$SG272 DB 'This program doesn''t work (forminfo= ''%s'')', 0aH, 00H
_DATA ENDS
BUG_4_TEXT SEGMENT
ASSUME CS: BUG_4_TEXT
PUBLIC _main
_main PROC FAR
;|*** /*
;|*** This program shows how CL can't even handle a simple operation as *pos++=..
;|*** without failing
;|*** */
;|***
;|*** #include <stdio.h>
;|***
;|*** #define MAX_SORT_ORDERS 16
;|***
;|*** typedef struct st_prt_var { /* Info p} sista sk{rmen */
;|*** char summaflag[MAX_SORT_ORDERS],repeat[1];
;|*** int sidbyteflag,sidsumma,start_sum,w_page,w_empty,leftmarg,rep_reg,rep_field;
;|*** } PRT_VAR;
;|***
;|*** typedef struct st_predit_param {
;|*** int max_width;
;|*** int post_width;
;|*** PRT_VAR prtvar; /* Inmatad form-info */
;|*** char *c_postfix;
;|*** } SCREENPARAM;
;|***
;|*** static void save_var(SCREENPARAM *s,char *forminfo);
;|*** static void get_number_or_field(char *repeat,int *rep_reg,int *rep_field);
;|***
;|*** int main(int argc,char *argv[])
;|*** {
; Line 26
*** 000000 55 push bp
*** 000001 8b ec mov bp,sp
*** 000003 83 ec 4a sub sp,74 ;004aH
*** 000006 57 push di
*** 000007 56 push si
; argc = 6
; argv = 8
; s = -74
; forminfo = -32
;|*** SCREENPARAM s;
;|*** char forminfo[32];
;|***
;|*** memset((char*) &forminfo,0,sizeof(forminfo));
; Line 30
*** 000008 33 c0 xor ax,ax
*** 00000a b9 20 00 mov cx,32 ;0020H
*** 00000d 8d 7e e0 lea di,WORD PTR [bp-32] ;forminfo
*** 000010 16 push ss
*** 000011 07 pop es
*** 000012 f3 rep
*** 000013 aa stosb
;|*** memset((char*) &s,0,sizeof(s));
; Line 31
*** 000014 b9 2a 00 mov cx,42 ;002aH
*** 000017 8d 7e b6 lea di,WORD PTR [bp-74] ;s
*** 00001a f3 rep
*** 00001b aa stosb
;|***
;|*** /* Fill structure with something */
;|*** memset(s.prtvar.summaflag,'!',16);
; Line 34
*** 00001c b8 21 00 mov ax,33 ;0021H
*** 00001f b9 10 00 mov cx,16 ;0010H
*** 000022 8d 7e ba lea di,WORD PTR [bp-70]
*** 000025 f3 rep
*** 000026 aa stosb
;|*** s.prtvar.sidbyteflag='W';
; Line 35
*** 000027 c7 46 cc 57 00 mov WORD PTR [bp-52],87 ;0057H
;|*** s.prtvar.sidsumma='O';
; Line 36
*** 00002c c7 46 ce 4f 00 mov WORD PTR [bp-50],79 ;004fH
;|*** s.prtvar.start_sum='R';
; Line 37
*** 000031 c7 46 d0 52 00 mov WORD PTR [bp-48],82 ;0052H
;|*** s.max_width='K';
; Line 38
*** 000036 c7 46 b6 4b 00 mov WORD PTR [bp-74],75 ;004bH ;s
;|*** s.prtvar.w_page='S';
; Line 39
*** 00003b c7 46 d2 53 00 mov WORD PTR [bp-46],83 ;0053H
;|*** s.post_width='!';
; Line 40
*** 000040 89 46 b8 mov WORD PTR [bp-72],ax
;|*** s.prtvar.rep_reg=0;
; Line 41
*** 000043 c7 46 d8 00 00 mov WORD PTR [bp-40],0
;|***
;|*** save_var(&s,forminfo);
; Line 43
*** 000048 8d 46 e0 lea ax,WORD PTR [bp-32] ;forminfo
*** 00004b 16 push ss
*** 00004c 50 push ax
*** 00004d 8d 46 b6 lea ax,WORD PTR [bp-74] ;s
*** 000050 16 push ss
*** 000051 50 push ax
*** 000052 9a 00 00 00 00 call FAR PTR save_var
*** 000057 83 c4 08 add sp,8
;|*** if (!strcmp(forminfo,"!!!!!!!!!!!!!!!!WORKS!"))
; Line 44
*** 00005a 8c d8 mov ax,ds
*** 00005c b9 17 00 mov cx,23 ;0017H
*** 00005f bf 00 00 mov di,OFFSET DGROUP:$SG269
*** 000062 8d 76 e0 lea si,WORD PTR [bp-32] ;forminfo
*** 000065 8e c0 mov es,ax
*** 000067 33 c0 xor ax,ax
*** 000069 f3 repz
*** 00006a a6 cmpsb
*** 00006b 74 05 je $L285
*** 00006d 1b c0 sbb ax,ax
*** 00006f 1d ff ff sbb ax,-1 ;ffffH
$L285:
*** 000072 0b c0 or ax,ax
*** 000074 75 10 jne $I268
;|*** puts("What a suprise, the function worked");
; Line 45
*** 000076 b8 17 00 mov ax,OFFSET DGROUP:$SG270
*** 000079 1e push ds
*** 00007a 50 push ax
*** 00007b 9a 00 00 00 00 call FAR PTR _puts
*** 000080 83 c4 04 add sp,4
;|*** else
; Line 46
*** 000083 eb 13 jmp SHORT $I271
*** 000085 90 nop
$I268:
;|*** printf("This program doesn't work (forminfo= '%s')\n",forminfo);
; Line 47
*** 000086 8d 46 e0 lea ax,WORD PTR [bp-32] ;forminfo
*** 000089 16 push ss
*** 00008a 50 push ax
*** 00008b b8 3b 00 mov ax,OFFSET DGROUP:$SG272
*** 00008e 1e push ds
*** 00008f 50 push ax
*** 000090 9a 00 00 00 00 call FAR PTR _printf
*** 000095 83 c4 08 add sp,8
$I271:
;|*** return 0;
; Line 48
*** 000098 33 c0 xor ax,ax
;|*** }
; Line 49
*** 00009a 5e pop si
*** 00009b 5f pop di
*** 00009c 8b e5 mov sp,bp
*** 00009e 5d pop bp
*** 00009f cb ret
_main ENDP
save_var PROC FAR
;|***
;|*** static void save_var(s,forminfo)
;|*** register SCREENPARAM *s;
;|*** register char *forminfo;
;|*** {
; Line 54
*** 0000a0 55 push bp
*** 0000a1 8b ec mov bp,sp
*** 0000a3 83 ec 0a sub sp,10 ;000aH
*** 0000a6 57 push di
*** 0000a7 56 push si
; s = 6
; forminfo = 10
; pos = -4
; prtvar = -8
;|*** char *pos;
;|*** PRT_VAR *prtvar;
;|***
;|*** prtvar= &s->prtvar;
;|*** get_number_or_field(prtvar->repeat,&prtvar->rep_reg,&prtvar->rep_field);
; Line 59
*** 0000a8 8b 46 06 mov ax,WORD PTR [bp+6] ;s
*** 0000ab 8b 56 08 mov dx,WORD PTR [bp+8]
*** 0000ae 05 04 00 add ax,4
*** 0000b1 8b c8 mov cx,ax
*** 0000b3 8b da mov bx,dx
*** 0000b5 05 20 00 add ax,32 ;0020H
*** 0000b8 52 push dx
*** 0000b9 50 push ax
*** 0000ba 8b d1 mov dx,cx
*** 0000bc 8b f3 mov si,bx
*** 0000be 83 c1 1e add cx,30 ;001eH
*** 0000c1 53 push bx
*** 0000c2 51 push cx
*** 0000c3 89 56 fc mov WORD PTR [bp-4],dx ;pos
*** 0000c6 89 76 fe mov WORD PTR [bp-2],si
*** 0000c9 83 c2 10 add dx,16 ;0010H
*** 0000cc 56 push si
*** 0000cd 52 push dx
*** 0000ce 8b f1 mov si,cx
*** 0000d0 8b fb mov di,bx
*** 0000d2 9a 00 00 00 00 call FAR PTR get_number_or_field
*** 0000d7 83 c4 0c add sp,12 ;000cH
;|*** pos=forminfo;
;|*** memcpy(pos,prtvar->summaflag,MAX_SORT_ORDERS);
; Line 61
*** 0000da 8b 46 fc mov ax,WORD PTR [bp-4] ;pos
*** 0000dd 8b 56 fe mov dx,WORD PTR [bp-2]
*** 0000e0 56 push si
*** 0000e1 57 push di
*** 0000e2 1e push ds
*** 0000e3 8b f0 mov si,ax
*** 0000e5 8e da mov ds,dx
ASSUME DS: NOTHING
*** 0000e7 c4 7e 0a les di,DWORD PTR [bp+10] ;forminfo
*** 0000ea b9 08 00 mov cx,8
*** 0000ed f3 rep
*** 0000ee a5 movsw
*** 0000ef 1f pop ds
ASSUME DS: DGROUP
*** 0000f0 5f pop di
*** 0000f1 5e pop si
;|*** pos+=16;
;|*** *pos++= (char) prtvar->sidbyteflag;
; Line 63
*** 0000f2 8e c2 mov es,dx
*** 0000f4 8b d8 mov bx,ax
*** 0000f6 26 8a 4f 12 mov cl,BYTE PTR es:[bx+18]
*** 0000fa c4 5e 0a les bx,DWORD PTR [bp+10] ;forminfo
*** 0000fd 26 88 4f 10 mov BYTE PTR es:[bx+16],cl
;|*** *pos++= (char) prtvar->sidsumma;
; Line 64
*** 000101 8e c2 mov es,dx
*** 000103 8b d8 mov bx,ax
*** 000105 26 8a 4f 14 mov cl,BYTE PTR es:[bx+20]
*** 000109 c4 5e 0a les bx,DWORD PTR [bp+10] ;forminfo
*** 00010c 83 c3 10 add bx,16 ;0010H
*** 00010f 26 88 4f 01 mov BYTE PTR es:[bx+1],cl
;|*** *pos++= (char) prtvar->start_sum;
; Line 65
*** 000113 8c c1 mov cx,es
*** 000115 8e c2 mov es,dx
*** 000117 8b d3 mov dx,bx
*** 000119 8b d8 mov bx,ax
*** 00011b 26 8a 5f 16 mov bl,BYTE PTR es:[bx+22]
*** 00011f 89 5e fa mov WORD PTR [bp-6],bx
*** 000122 bb 01 00 mov bx,1
*** 000125 03 da add bx,dx
*** 000127 8e c1 mov es,cx
*** 000129 8a 46 fa mov al,BYTE PTR [bp-6]
***